#ifndef CCCLIENTPROCESS_H
#define CCCLIENTPROCESS_H
#include"CCStreamServerDef.h"
#include"CCThread.h"
#include"JCQueueDef.h"

class CCClientProcess
{
private:
    int m_clientsockfd;
    std::atomic_bool m_bClientRunning;
    pthread_mutex_t m_recvMutex;
    pthread_mutex_t m_sendMutex;
    JCMediaQueue<CC_AVStream*> m_avStreamQueue;
    
private:
    static void startRecvThread(long long num);
    static void startRSendThread(long long num);
    void RunRecvThread();
    void RunSendThread();
    bool recvSocketData(char* pbuff,unsigned int length);
    bool sendSocketData(char* pbuff,unsigned int length);
    void LoseAlive();
    void freeAllRemainAVStream();
    void closeListenSocketfd();
public:
    bool getClientAliveStatus();
    CCClientProcess();
    ~CCClientProcess();
    void StartClientProcessWithSockfd(int fd);
    void EnqueueAVStream(uint8_t* buff,uint32_t buffsize,uint16_t type);


};





#endif